package com.study.studycase.demo5;

/**
 * @author ctl
 * @date 2024-01-30
 */
@SuppressWarnings("all")
public class subStringTest {
    public static String str = "hello world";
    public static String str2 = "hell";
    public static void main(String[] args) {
        String substring1 = str.substring(7);//0开始，截取下标为7后面的，包含开始位置的字符串
        String substring2 = str.substring(0, 7);//从0开始，截取7个字符串
        System.out.println("substring1 = " + substring1);
        System.out.println("substring2 = " + substring2);
        String substring3 = str2.substring(0,str2.length());
        System.out.println("substring3 = " + substring3);
    }
}
